package com.pt25.service.sys.interfaces.vo.config;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.pt25.base.util.JsonUtil;
import com.pt25.base.util.PageUtil;
import com.pt25.base.validator.CreateGroup;
import com.pt25.base.validator.UpdateGroup;
import com.pt25.service.sys.domain.config.ddo.ConfigValue;
import jakarta.validation.constraints.NotNull;
import lombok.*;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(
    callSuper = true
)
public class ConfigValueVo extends PageUtil.PageBase {
  @JsonFormat(
      shape = JsonFormat.Shape.STRING
  )

  @NotNull(groups = {UpdateGroup.class}, message = "id不能为空")
  private Long id;

  @JsonFormat(shape = JsonFormat.Shape.STRING)
  @NotNull(groups = {CreateGroup.class}, message = "configDataId不能为空")
  private Long configDataId;

  private String valueKey;

  @NotNull(groups = {CreateGroup.class, UpdateGroup.class}, message = "valueContent不能为空")
  private Object valueContent;

  private String valueDescription;


  public ConfigValue toConfigValue() {
    return JsonUtil.toBean(JsonUtil.toJson(this), ConfigValue.class);
  }
}
